/* 
 *  Incub - incubate your baby robot
 *  Copyright (C) 2008 Stanislaw Szymczyk
 *  e-mail: sszymczy@gmail.com   www: http://cogville.cog-lab.com
 *
 *  This file is part of Incub.
 *
 *  Incub is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  Incub is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Incub.  If not, see <http://www.gnu.org/licenses/>.
 * 
 */
 
#ifndef PHYSICAL_JOINT_H_
#define PHYSICAL_JOINT_H_

#include <math.h>
#include "ode/ode.h"
#include <iostream>

class GenericPhysicalJoint {
	protected:
	static float factor;
	public:
	virtual void update(dJointID jointID) { std::cout << "update what?!?" << std::endl; };
	virtual void setVelocityAndForce(dJointID jointID, int axisNumber, double velocity, double force) = 0;
	virtual void setTorque(dJointID jointID, int axisNumber, double torque) = 0;
	virtual dJointID init(dWorldID dynWorld, dBodyID body1, dBodyID body2, dVector3 globalPos, dMatrix3 globalRot) { return 0; };
	virtual ~GenericPhysicalJoint() { };
};

template<typename S>
class PhysicalJoint : public GenericPhysicalJoint {
	public:
	void update(dJointID jointID);
	dJointID init(dWorldID dynWorld, dBodyID body1, dBodyID body2, dVector3 globalPos, dMatrix3 globalRot);
	void setVelocityAndForce(dJointID jointID, int axisNumber, double velocity, double force);
	void setTorque(dJointID jointID, int axisNumber, double torque);
};

#endif /*PHYSICAL_JOINT_H_*/
